package stateDiagram.figures;

import static org.jhotdraw.draw.AttributeKeys.TEXT;

import org.jhotdraw.draw.TextFigure;

import stateDiagram.EntityObjects.StateEntity;

public class EntryActionTextFigure extends TextFigure{
	private StateEntity entity;
	
	public EntryActionTextFigure(StateEntity entity){
		super();
		this.entity =  entity;
	}
	
	public void setText(String newText) {
		String previousContents = getText();
		willChange();
		if(newText != null){
			if (previousContents !=null && ! previousContents.equals(newText)){
				entity.setEntryAction(newText);
			}
		
        super.set(TEXT, newText);
        changed();
		}
		else{super.set(TEXT, newText);}
    }
}
